package com.xy.manage.service.impl;


import java.util.List;
import java.util.Map;
import java.util.Date;
import com.xy.core.util.BeanUtil;
import com.xy.common.page.Pagination;
import com.xy.core.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.xy.manage.dao.TreplyDao;
import com.xy.manage.model.Treply;
import com.xy.manage.service.TreplyService;

@Service
@Transactional
public class TreplyServiceImpl extends BaseServiceImpl<Treply> implements
		TreplyService {
	private TreplyDao treplyDao;

	public TreplyServiceImpl(TreplyDao paramAppRoleDao) {
		super(paramAppRoleDao);
		this.treplyDao = paramAppRoleDao;
	}

	@Override
	public boolean checkExist(String paraName, String paraValue) {
		return treplyDao.checkExist("Treply", paraName, paraValue);
	}

	@Override
	public List<Treply> getTreply(Map<String, Object> map) {
		return treplyDao.getTreply(map);
	}
	@Override
	public Pagination getTreplyByPage(Map<String, Object> map, int pageNo,
			int pageSize) {
		// TODO Auto-generated method stub
		return treplyDao.getTreplyByPage(map, pageNo, pageSize);
	}
	 
   @Override
	public Treply save(Treply treply) {
	//	treply.setModtime(new Date());
		if(treply.getRid()==null){
			//新增
        	return super.save(treply);
		}else{
			//更新
			Treply treply1=treplyDao.get(treply.getRid());
			try {
				BeanUtil.copyNotNullProperties(treply1, treply);
			} catch (Exception e) {
				e.printStackTrace();
			}  
			return super.save(treply1);
		}
	}
}